package cn.gd.service.Announcements;

import cn.gd.mapper.Announcements.AnnouncementMapper;
import cn.gd.pojo.Announcements;
import cn.gd.pojo.Users;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wyh
 * @version 1.80
 */
@Service
public class AnnouncementServiceImpl implements AnnouncementService{
    @Autowired
    private AnnouncementMapper announcementMapper;

    @Override
    public PageInfo<Announcements> announcementsGetAll(Integer pageNo,
                                                       Integer pageSize) {
        PageHelper.startPage(pageNo,pageSize);
        return new PageInfo<>(announcementMapper.getAnnouncementsAll());
    }

    @Override
    public int announcementsAdd(Announcements announcements) {
        return announcementMapper.addAnnouncements(announcements);
    }

    @Override
    public Announcements announcementsGetId(Integer id) {
        return announcementMapper.getAnnouncementsId(id);
    }

    @Override
    public int announcementsUpdate(Announcements announcements) {
        return announcementMapper.updateAnnouncements(announcements);
    }

    @Override
    public int announcementsDelete(Integer id) {
        return announcementMapper.deleteAnnouncements(id);
    }

    @Override
    public List<Users> getUserAll() {
        return announcementMapper.getUserAll();
    }
}
